﻿/*
 * Crée par SharpDevelop.
 * Utilisateur: Davyd REY
 * Date: 27/03/2011
 * Heure: 00:29
 */
using System;
using System.Drawing;
using System.Windows.Forms;

namespace dotSqlCopy
{
	/// <summary>
	/// Description of FormChoixConfig.
	/// </summary>
	public partial class FormChoixConfig : ComponentFactory.Krypton.Toolkit.KryptonForm
	{
		public FormMain _ParentForm = null;
		public string SelectedValue = "";
		
		public FormChoixConfig()
		{
			//
			// The InitializeComponent() call is required for Windows Forms designer support.
			//
			InitializeComponent();
			
			//
			// TODO: Add constructor code after the InitializeComponent() call.
			//
		}
		
		public void Init()
		{
			comboBoxConfigs.DataSource = _ParentForm._configuration.GetConfigs();
			comboBoxConfigs.ValueMember = "configName";
			comboBoxConfigs.DisplayMember = "configName";
		}
		
		void ButtonOkClick(object sender, EventArgs e)
		{
			SelectedValue = comboBoxConfigs.SelectedValue.ToString();
			this.DialogResult = DialogResult.OK;
		}
		
		void BtnDelClick(object sender, EventArgs e)
		{
			SelectedValue = comboBoxConfigs.SelectedValue.ToString();
			_ParentForm._configuration.DelConfig(SelectedValue);
			if (_ParentForm._configuration.GetConfigs().Rows.Count>0)
				Init();
			else
				this.DialogResult = DialogResult.Cancel;
		}
	}
}
